﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace EazyCMS.Web.Plugin.Naire.BLL
{
    public partial class naire
    {
        private readonly EazyCMS.Model.siteconfig siteConfig = new EazyCMS.BLL.siteconfig().loadConfig(); //获得站点配置信息
        private readonly DAL.naire dal;
        public naire()
        {
            dal = new DAL.naire(siteConfig.sysdatabaseprefix);
        }

        #region 基本方法=============================
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            return dal.Exists(id);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.naire model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 修改一列数据
        /// </summary>
        public void UpdateField(int id, string strValue)
        {
            dal.UpdateField(id, strValue);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.naire model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.naire GetModel(int id)
        {
            return dal.GetModel(id);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        //public bool Delete(int id)
        //{
        //    return dal.Delete(id);
        //}

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        //public Model.vote GetModel(int id)
        //{
        //    return dal.GetModel(id);
        //}

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }

        /// <summary>
        /// 获得查询分页数据
        /// </summary>
        public DataSet GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
        {
            return dal.GetList(pageSize, pageIndex, strWhere, filedOrder, out recordCount);
        }

        #endregion

        #region 扩展方法=============================
        /// <summary>
        /// 是否已过期
        /// </summary>
        public bool IsExpired(int vote_id)
        {
            return dal.IsExpired(vote_id);
        }

        /// <summary>
        /// 用户投票
        /// </summary>
        //public bool AddVote(int vote_id, string remark, string strIds)
        //{
        //    return dal.AddVote(vote_id, remark, strIds);
        //}
        #endregion
    }
}
